<?php
header("Content-type:text/html;charset=utf-8");
require '../../../php/database_login.php';

$return = [];
$pack_id = $_POST['arr']['pack_id'];
$sql = "select * from `multipack_brief` where `pack_id` = '{$pack_id}' limit 1";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$return['b_f']['back'] = "https://hcecpod-1343049753.cos.accelerate.myqcloud.com/multipack/" . $row['back'];
$return['b_f']['front'] = "https://hcecpod-1343049753.cos.accelerate.myqcloud.com/multipack/" . $row['front'];

$sql = "select * from `multipack_detail` where `pack_id` = '{$pack_id}' order by `order` asc";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
    $key = $row['id_name'];
    unset($row['id']);
    unset($row['pack_id']);
    $row['pic'] = "https://hcecpod-1343049753.cos.accelerate.myqcloud.com/multipack/" . $row['pic'];
    $return['img'][$key] = $row;
}
echo json_encode($return);
